package com.swyc.osschat.Test.designMode.interpreter.strategy;

import com.swyc.osschat.Test.designMode.interpreter.base.AbstractExpression;

import com.swyc.osschat.Test.designMode.interpreter.vo.Context;

/**
 * @description 非终结表达式角色：减法
 * @Author: z156940l@outlook.com
 * @className MinusExpression
 * @Date: 2022/6/27 15:29
 */
public class MinusExpression extends AbstractExpression {
    //左边表达式 变量
    private AbstractExpression left;
    //右边表达式 变量
    private AbstractExpression right;

    public MinusExpression(AbstractExpression left, AbstractExpression right) {
        this.left = left;
        this.right = right;
    }

    @Override
    public int interpret(Context context) {
        //返回左边的值 - 右边的值
        return left.interpret(context)-right.interpret(context);
    }
}
